package com.roy.galaxy.algorithm;

/**
 * @author gang.wang1903@xiaobao100.cn
 * @Date: 2019-10-08 09:37
 */
public class MinNumberInRotateArray {


    public int minNumberInRotateArray(int [] array) {

        if(array.length == 0){
            return 0;
        }

        for(int i = 0 ; i < array.length ; i ++){

            if(array[i] > array[i + 1]){
                return array[i + 1];
            }
        }
        return 0;
    }

    public static void main(String[] args) {
        int [] array = new int[] {3,4,5,1,2};
       System.out.print( new MinNumberInRotateArray().minNumberInRotateArray(array));
    }
}
